package org.wlgzs.shop.service.impl;

        import org.springframework.beans.factory.annotation.Autowired;
        import org.springframework.stereotype.Service;
        import org.wlgzs.shop.bean.GoodsData;
        import org.wlgzs.shop.bean.Msg;
        import org.wlgzs.shop.bean.Store;
        import org.wlgzs.shop.dao.StoreMapper;
        import org.wlgzs.shop.service.IGoodsDateService;
        import org.wlgzs.shop.service.IStoreMan;

        import javax.annotation.Resource;
@Service
public class StroeMan implements IStoreMan {

    @Resource
    StoreMapper storeMapper;
    @Resource(name = "GoodsDateService")
    IGoodsDateService goodsDateService;

    //创建商店
    @Override
    public Msg buildStore(Store store) {
        if (store == null) {
            return Msg.fail().add("errors","店铺创建失败!");
        }
        int a=storeMapper.insert(store);
         if(a==0||a<0){
             return Msg.fail().add("errors","店铺创建失败!");
        }
         else {
            return Msg.success().add("win","店铺创建成功！");
         }
    }

    //添加商品
    @Override
    public Msg addGoods(GoodsData goodsData, String twoKind) {
        return  goodsDateService.addGood(goodsData,twoKind);
    }

    //下架商品
    @Override
    public Msg deleteGoods(int goodsId) {
        return goodsDateService.deleteGoods(goodsId);
    }

    //查看订单
    @Override
    public Msg selectOrder() {

        return null;
    }
}
